#include "stdafx.h"
#include "ItemCategory.h"

#include "../db/ItemCategory.h"

#ifdef WIN32
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#endif

namespace serika
{
	namespace dq
	{
		ItemCategory::ItemCategory(db::ItemCategory* category, TransientState::Enum state)
		{
			mCategory = new Category(category, state);
		}

		ItemCategory::~ItemCategory()
		{
			delete mCategory;
		}

		ItemCategory* ItemCategory::FromDb(db::ItemCategory* category)
		{
			return new ItemCategory(category, TransientState::Clean);
		}

		int ItemCategory::GetId() const
		{
			return mCategory->GetInt("id");
		}

		const ut::String& ItemCategory::GetName() const
		{
			return mCategory->GetString("name");
		}
	}
}
